package websimulator;

import java.util.*;

public class Temperatur 
{
    public ArrayList <Double>tempOut = new ArrayList<Double>();
    public ArrayList <Double>tempIn = new ArrayList<Double>();
    private double startTempOut = -10.5;   //Temperatur i begynnelsen av simulasjon
    
    /**
     * Her skal vi bare hardcode informasjon om temperatur i simulerings timer
     */
    public Temperatur()
    {
        for (int i = 0; i < 5; i++)
            tempOut.add(startTempOut = startTempOut - 0.3);
        for (int i = 5; i < 17; i++)
            tempOut.add(startTempOut = startTempOut + 0.1); //øke temperatur for 0.1 grad per time
        for (int i =17; i < 25; i++)
            tempOut.add(startTempOut = startTempOut - 0.2); //senke temperatur for 0.2 grad per time
        
        for (int i = 0; i < 7; i++)
            tempIn.add(18D);
        for (int i = 7; i < 10; i++)
            tempIn.add(22D);
        for (int i = 10; i < 17; i++)
            tempIn.add(18D);
        for (int i = 17; i < 25; i++)
            tempIn.add(22D);
    }
    
    /**
     * Brukes i Menu
     * @param _yes 
     */
    public Temperatur(Boolean _yes)
    {
        tempOut = new ArrayList<Double>(25);
        tempIn = new ArrayList<Double>(25);
    }
    
    
    /** 
     * @return ArrayList med temperatur ute
     */
    public ArrayList temperaturOutside()
    {
        return tempOut;
    }
    
    /**
     * 
     * @return ArrayList med temperatur inne
     */
    public ArrayList temperaturInside()
    {
        return tempIn;
    }
    
    public void setTemperaturOutside(int _time, String _temp)
    {
        tempOut.set(_time, Double.parseDouble(_temp));
    }
    
    public void setTemperaturInside(int _time, String _temp)
    {
        tempIn.set(_time, Double.parseDouble(_temp));
    }
    
    public void addTemperaturOutside(int _time, String _temp)
    {
        tempOut.add(_time, Double.parseDouble(_temp));
    }
    
    public void addTemperaturInside(int _time, String _temp)
    {
        tempIn.add(_time, Double.parseDouble(_temp));
    }
    
    public String getTemperaturOutside(int _time)
    {
        return tempOut.get(_time).toString();
    }
    
    public String getTemperaturInside(int _time)
    {
        return tempIn.get(_time).toString();
    }
}
